<?php

// +----------------------------------------------------------------------
// | Admin Plugin for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2024 ThinkAdmin [ thinkadmin.top ]
// +----------------------------------------------------------------------
// | 官方网站: https://thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// | 免责声明 ( https://thinkadmin.top/disclaimer )
// +----------------------------------------------------------------------
// | gitee 代码仓库：https://gitee.com/zoujingli/think-plugs-admin
// | github 代码仓库：https://github.com/zoujingli/think-plugs-admin
// +----------------------------------------------------------------------

declare(strict_types=1);

namespace app\dao\controller;

use app\api\model\Bazilogs;
use think\admin\Controller;
use think\admin\helper\QueryHelper;

/**
 * @class Pan
 * @package app\dao\controller
 */
class Pan extends Controller
{
    /**
     * 会员订单
     * @auth true
     * @menu true
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        Bazilogs::mQuery()->layTable(function () {
            $this->title = '排盘统计';
        }, static function (QueryHelper $query) {
            $query->like('zh')->dateBetween('date')->order('date desc');
        });
    }

    public function delete()
    {
        $zh = $this->request->get('zh', '');
        if (empty($zh)) $this->error('缺少必要参数');
        $bool = Bazilogs::mk()->where(['zh' => $zh])->delete();
        if ($bool === false) $this->error('记录删除失败!');
        $this->success('记录删除成功~');
    }
}
